#include <stdio.h>
#include <stdlib.h>

typedef struct node {
    int data;
    struct node *next;
}Node;

     // 请在此添加你的代码
    /********** Begin **********/
    Node *CreatList(void)
{
    int val, i, n;
    Node *phead, *p, *q;
    phead = (Node *)malloc(sizeof(Node));
    q=phead;
    q->next=NULL;
    scanf("%d", &n);
    for(i=0; i<n; ++i)
    {
        scanf("%d", &val);
        p = (Node *)malloc(sizeof(Node));
        p->data=val;
        q->next=p;
        p->next=NULL;
        q=p;
    }
    return phead;
}
//输出链表
void ShowList(Node *phead)
{
    Node *p;
    p = phead->next;
    while(p)
    {
        printf("%d ", p->data);
        p = p->next;
    }
    printf("\n");
}

    /**********  End  **********/
int main(void)
{
    Node *phead;
    phead = CreatList();
    ShowList(phead);
    return 0;
}